
#include "nx_api.h"

#ifdef __PRODUCT_NETXDUO__
#include "netx_mdns_test.h"

/* Frame (134 bytes) */
static const unsigned char pkt1[134] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x0c, /* ..^..... */
0x29, 0x01, 0xd4, 0x79, 0x08, 0x00, 0x45, 0x00, /* )..y..E. */
0x00, 0x78, 0x00, 0x00, 0x40, 0x00, 0xff, 0x11, /* .x..@... */
0xd9, 0x67, 0xc0, 0xa8, 0x00, 0x69, 0xe0, 0x00, /* .g...i.. */
0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x64, /* .......d */
0x0c, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* .O...... */
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x11, 0x53, /* .......S */
0x69, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x57, 0x65, /* imple We */
0x62, 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, /* b Server */
0x05, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, /* ._http._ */
0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, /* tcp.loca */
0x6c, 0x00, 0x00, 0xff, 0x00, 0x01, 0xc0, 0x0c, /* l....... */
0x00, 0x21, 0x00, 0x01, 0x00, 0x00, 0x00, 0x78, /* .!.....x */
0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, /* .......P */
0x06, 0x75, 0x62, 0x75, 0x6e, 0x74, 0x75, 0xc0, /* .ubuntu. */
0x29, 0xc0, 0x0c, 0x00, 0x10, 0x00, 0x01, 0x00, /* )....... */
0x00, 0x11, 0x94, 0x00, 0x01, 0x00              /* ...... */
};

/* Frame (134 bytes) */
static const unsigned char pkt2[134] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x0c, /* ..^..... */
0x29, 0x01, 0xd4, 0x79, 0x08, 0x00, 0x45, 0x00, /* )..y..E. */
0x00, 0x78, 0x00, 0x00, 0x40, 0x00, 0xff, 0x11, /* .x..@... */
0xd9, 0x67, 0xc0, 0xa8, 0x00, 0x69, 0xe0, 0x00, /* .g...i.. */
0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x64, /* .......d */
0x0c, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* .O...... */
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x11, 0x53, /* .......S */
0x69, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x57, 0x65, /* imple We */
0x62, 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, /* b Server */
0x05, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, /* ._http._ */
0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, /* tcp.loca */
0x6c, 0x00, 0x00, 0xff, 0x00, 0x01, 0xc0, 0x0c, /* l....... */
0x00, 0x21, 0x00, 0x01, 0x00, 0x00, 0x00, 0x78, /* .!.....x */
0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, /* .......P */
0x06, 0x75, 0x62, 0x75, 0x6e, 0x74, 0x75, 0xc0, /* .ubuntu. */
0x29, 0xc0, 0x0c, 0x00, 0x10, 0x00, 0x01, 0x00, /* )....... */
0x00, 0x11, 0x94, 0x00, 0x01, 0x00              /* ...... */
};

/* Frame (134 bytes) */
static const unsigned char pkt3[134] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x0c, /* ..^..... */
0x29, 0x01, 0xd4, 0x79, 0x08, 0x00, 0x45, 0x00, /* )..y..E. */
0x00, 0x78, 0x00, 0x00, 0x40, 0x00, 0xff, 0x11, /* .x..@... */
0xd9, 0x67, 0xc0, 0xa8, 0x00, 0x69, 0xe0, 0x00, /* .g...i.. */
0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x64, /* .......d */
0x0c, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* .O...... */
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x11, 0x53, /* .......S */
0x69, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x57, 0x65, /* imple We */
0x62, 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, /* b Server */
0x05, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, /* ._http._ */
0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, /* tcp.loca */
0x6c, 0x00, 0x00, 0xff, 0x00, 0x01, 0xc0, 0x0c, /* l....... */
0x00, 0x21, 0x00, 0x01, 0x00, 0x00, 0x00, 0x78, /* .!.....x */
0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, /* .......P */
0x06, 0x75, 0x62, 0x75, 0x6e, 0x74, 0x75, 0xc0, /* .ubuntu. */
0x29, 0xc0, 0x0c, 0x00, 0x10, 0x00, 0x01, 0x00, /* )....... */
0x00, 0x11, 0x94, 0x00, 0x01, 0x00              /* ...... */
};

/* Frame (223 bytes) */
static const unsigned char pkt4[223] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x0c, /* ..^..... */
0x29, 0x01, 0xd4, 0x79, 0x08, 0x00, 0x45, 0x00, /* )..y..E. */
0x00, 0xd1, 0x00, 0x00, 0x40, 0x00, 0xff, 0x11, /* ....@... */
0xd9, 0x0e, 0xc0, 0xa8, 0x00, 0x69, 0xe0, 0x00, /* .....i.. */
0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0xbd, /* ........ */
0xc6, 0xe4, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* ........ */
0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x11, 0x53, /* .......S */
0x69, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x57, 0x65, /* imple We */
0x62, 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, /* b Server */
0x05, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, /* ._http._ */
0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, /* tcp.loca */
0x6c, 0x00, 0x00, 0x10, 0x80, 0x01, 0x00, 0x00, /* l....... */
0x11, 0x94, 0x00, 0x01, 0x00, 0xc0, 0x1e, 0x00, /* ........ */
0x0c, 0x00, 0x01, 0x00, 0x00, 0x11, 0x94, 0x00, /* ........ */
0x02, 0xc0, 0x0c, 0xc0, 0x0c, 0x00, 0x21, 0x80, /* ......!. */
0x01, 0x00, 0x00, 0x00, 0x78, 0x00, 0x0f, 0x00, /* ....x... */
0x00, 0x00, 0x00, 0x00, 0x50, 0x06, 0x75, 0x62, /* ....P.ub */
0x75, 0x6e, 0x74, 0x75, 0xc0, 0x29, 0xc0, 0x5b, /* untu.).[ */
0x00, 0x1c, 0x80, 0x01, 0x00, 0x00, 0x00, 0x78, /* .......x */
0x00, 0x10, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, /* ........ */
0x00, 0x00, 0x02, 0x0c, 0x29, 0xff, 0xfe, 0x01, /* ....)... */
0xd4, 0x79, 0xc0, 0x5b, 0x00, 0x01, 0x80, 0x01, /* .y.[.... */
0x00, 0x00, 0x00, 0x78, 0x00, 0x04, 0xc0, 0xa8, /* ...x.... */
0x00, 0x69, 0x09, 0x5f, 0x73, 0x65, 0x72, 0x76, /* .i._serv */
0x69, 0x63, 0x65, 0x73, 0x07, 0x5f, 0x64, 0x6e, /* ices._dn */
0x73, 0x2d, 0x73, 0x64, 0x04, 0x5f, 0x75, 0x64, /* s-sd._ud */
0x70, 0xc0, 0x29, 0x00, 0x0c, 0x00, 0x01, 0x00, /* p.)..... */
0x00, 0x11, 0x94, 0x00, 0x02, 0xc0, 0x1e        /* ....... */
};

/* Frame (223 bytes) */
static const unsigned char pkt5[223] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x0c, /* ..^..... */
0x29, 0x01, 0xd4, 0x79, 0x08, 0x00, 0x45, 0x00, /* )..y..E. */
0x00, 0xd1, 0x00, 0x00, 0x40, 0x00, 0xff, 0x11, /* ....@... */
0xd9, 0x0e, 0xc0, 0xa8, 0x00, 0x69, 0xe0, 0x00, /* .....i.. */
0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0xbd, /* ........ */
0xc6, 0xe4, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* ........ */
0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x11, 0x53, /* .......S */
0x69, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x57, 0x65, /* imple We */
0x62, 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, /* b Server */
0x05, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, /* ._http._ */
0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, /* tcp.loca */
0x6c, 0x00, 0x00, 0x10, 0x80, 0x01, 0x00, 0x00, /* l....... */
0x11, 0x94, 0x00, 0x01, 0x00, 0xc0, 0x1e, 0x00, /* ........ */
0x0c, 0x00, 0x01, 0x00, 0x00, 0x11, 0x94, 0x00, /* ........ */
0x02, 0xc0, 0x0c, 0xc0, 0x0c, 0x00, 0x21, 0x80, /* ......!. */
0x01, 0x00, 0x00, 0x00, 0x78, 0x00, 0x0f, 0x00, /* ....x... */
0x00, 0x00, 0x00, 0x00, 0x50, 0x06, 0x75, 0x62, /* ....P.ub */
0x75, 0x6e, 0x74, 0x75, 0xc0, 0x29, 0xc0, 0x5b, /* untu.).[ */
0x00, 0x1c, 0x80, 0x01, 0x00, 0x00, 0x00, 0x78, /* .......x */
0x00, 0x10, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, /* ........ */
0x00, 0x00, 0x02, 0x0c, 0x29, 0xff, 0xfe, 0x01, /* ....)... */
0xd4, 0x79, 0xc0, 0x5b, 0x00, 0x01, 0x80, 0x01, /* .y.[.... */
0x00, 0x00, 0x00, 0x78, 0x00, 0x04, 0xc0, 0xa8, /* ...x.... */
0x00, 0x69, 0x09, 0x5f, 0x73, 0x65, 0x72, 0x76, /* .i._serv */
0x69, 0x63, 0x65, 0x73, 0x07, 0x5f, 0x64, 0x6e, /* ices._dn */
0x73, 0x2d, 0x73, 0x64, 0x04, 0x5f, 0x75, 0x64, /* s-sd._ud */
0x70, 0xc0, 0x29, 0x00, 0x0c, 0x00, 0x01, 0x00, /* p.)..... */
0x00, 0x11, 0x94, 0x00, 0x02, 0xc0, 0x1e        /* ....... */
};

/* Frame (223 bytes) */
static const unsigned char pkt6[223] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x0c, /* ..^..... */
0x29, 0x01, 0xd4, 0x79, 0x08, 0x00, 0x45, 0x00, /* )..y..E. */
0x00, 0xd1, 0x00, 0x00, 0x40, 0x00, 0xff, 0x11, /* ....@... */
0xd9, 0x0e, 0xc0, 0xa8, 0x00, 0x69, 0xe0, 0x00, /* .....i.. */
0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0xbd, /* ........ */
0xc6, 0xe4, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* ........ */
0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x11, 0x53, /* .......S */
0x69, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x57, 0x65, /* imple We */
0x62, 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, /* b Server */
0x05, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, /* ._http._ */
0x74, 0x63, 0x70, 0x05, 0x6c, 0x6f, 0x63, 0x61, /* tcp.loca */
0x6c, 0x00, 0x00, 0x10, 0x80, 0x01, 0x00, 0x00, /* l....... */
0x11, 0x94, 0x00, 0x01, 0x00, 0xc0, 0x1e, 0x00, /* ........ */
0x0c, 0x00, 0x01, 0x00, 0x00, 0x11, 0x94, 0x00, /* ........ */
0x02, 0xc0, 0x0c, 0xc0, 0x0c, 0x00, 0x21, 0x80, /* ......!. */
0x01, 0x00, 0x00, 0x00, 0x78, 0x00, 0x0f, 0x00, /* ....x... */
0x00, 0x00, 0x00, 0x00, 0x50, 0x06, 0x75, 0x62, /* ....P.ub */
0x75, 0x6e, 0x74, 0x75, 0xc0, 0x29, 0xc0, 0x5b, /* untu.).[ */
0x00, 0x1c, 0x80, 0x01, 0x00, 0x00, 0x00, 0x78, /* .......x */
0x00, 0x10, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, /* ........ */
0x00, 0x00, 0x02, 0x0c, 0x29, 0xff, 0xfe, 0x01, /* ....)... */
0xd4, 0x79, 0xc0, 0x5b, 0x00, 0x01, 0x80, 0x01, /* .y.[.... */
0x00, 0x00, 0x00, 0x78, 0x00, 0x04, 0xc0, 0xa8, /* ...x.... */
0x00, 0x69, 0x09, 0x5f, 0x73, 0x65, 0x72, 0x76, /* .i._serv */
0x69, 0x63, 0x65, 0x73, 0x07, 0x5f, 0x64, 0x6e, /* ices._dn */
0x73, 0x2d, 0x73, 0x64, 0x04, 0x5f, 0x75, 0x64, /* s-sd._ud */
0x70, 0xc0, 0x29, 0x00, 0x0c, 0x00, 0x01, 0x00, /* p.)..... */
0x00, 0x11, 0x94, 0x00, 0x02, 0xc0, 0x1e        /* ....... */
};

/* Frame (223 bytes) */
static const unsigned char pkt7[223] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x0c, /* ..^..... */
0x29, 0x01, 0xd4, 0x79, 0x08, 0x00, 0x45, 0x00, /* )..y..E. */
0x00, 0xd1, 0x00, 0x00, 0x40, 0x00, 0xff, 0x11, /* ....@... */
0xd9, 0x0e, 0xc0, 0xa8, 0x00, 0x69, 0xe0, 0x00, /* .....i.. */
0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0xbd, /* ........ */
0x6e, 0xb6, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* n....... */
0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x09, 0x5f, /* ......._ */
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, /* services */
0x07, 0x5f, 0x64, 0x6e, 0x73, 0x2d, 0x73, 0x64, /* ._dns-sd */
0x04, 0x5f, 0x75, 0x64, 0x70, 0x05, 0x6c, 0x6f, /* ._udp.lo */
0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01, /* cal..... */
0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x05, 0x5f, /* ......._ */
0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, /* http._tc */
0x70, 0xc0, 0x23, 0xc0, 0x34, 0x00, 0x0c, 0x00, /* p.#.4... */
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x11, /* ........ */
0x53, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x57, /* Simple W */
0x65, 0x62, 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, /* eb Serve */
0x72, 0xc0, 0x34, 0xc0, 0x4d, 0x00, 0x21, 0x80, /* r.4.M.!. */
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, /* ........ */
0x00, 0x00, 0x00, 0x00, 0x50, 0x06, 0x75, 0x62, /* ....P.ub */
0x75, 0x6e, 0x74, 0x75, 0xc0, 0x23, 0xc0, 0x73, /* untu.#.s */
0x00, 0x1c, 0x80, 0x01, 0x00, 0x00, 0x00, 0x78, /* .......x */
0x00, 0x10, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, /* ........ */
0x00, 0x00, 0x02, 0x0c, 0x29, 0xff, 0xfe, 0x01, /* ....)... */
0xd4, 0x79, 0xc0, 0x73, 0x00, 0x01, 0x80, 0x01, /* .y.s.... */
0x00, 0x00, 0x00, 0x78, 0x00, 0x04, 0xc0, 0xa8, /* ...x.... */
0x00, 0x69, 0xc0, 0x4d, 0x00, 0x10, 0x80, 0x01, /* .i.M.... */
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00        /* ....... */
};

/* Frame (107 bytes) */
static const unsigned char pkt8[107] = {
0x01, 0x00, 0x5e, 0x00, 0x00, 0xfb, 0x00, 0x1e, /* ..^..... */
0x8f, 0xb1, 0x7a, 0xd4, 0x08, 0x00, 0x45, 0x00, /* ..z...E. */
0x00, 0x5d, 0x13, 0xc0, 0x00, 0x00, 0xff, 0x11, /* .]...... */
0x06, 0x28, 0xc0, 0xa8, 0x00, 0x04, 0xe0, 0x00, /* .(...... */
0x00, 0xfb, 0x14, 0xe9, 0x14, 0xe9, 0x00, 0x49, /* .......I */
0x79, 0x60, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* y`...... */
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x09, 0x5f, /* ......._ */
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, /* services */
0x07, 0x5f, 0x64, 0x6e, 0x73, 0x2d, 0x73, 0x64, /* ._dns-sd */
0x04, 0x5f, 0x75, 0x64, 0x70, 0x05, 0x6c, 0x6f, /* ._udp.lo */
0x63, 0x61, 0x6c, 0x00, 0x00, 0x0c, 0x00, 0x01, /* cal..... */
0x00, 0x00, 0x11, 0x94, 0x00, 0x0d, 0x05, 0x5f, /* ......._ */
0x68, 0x74, 0x74, 0x70, 0x04, 0x5f, 0x74, 0x63, /* http._tc */
0x70, 0xc0, 0x23                                /* p.# */
};

MDNS_RR_DATA mdns_rr_data[] = {
    {"Simple Web Server", "_http._tcp", "local"},
};

MDNS_TEST_SEQ mdns_client_passive[] = {
    {TITLE, "Client passive", 14, 0},

    {INJECT, (char*)&pkt1[0], sizeof(pkt1), 0},
    {INJECT, (char*)&pkt2[0], sizeof(pkt2), 0},
    {INJECT, (char*)&pkt3[0], sizeof(pkt3), 0},
    {MDNS_CHECK_RR_COUNT_REMOTE, NX_NULL, 0, 0},
    {INJECT, (char*)&pkt4[0], sizeof(pkt4), 0},
    {MDNS_CHECK_RR_COUNT_REMOTE, NX_NULL, 6, 0},
    {MDNS_CHECK_RR_DATA, (char*)mdns_rr_data, 1, 0},
    {INJECT, (char*)&pkt5[0], sizeof(pkt5), 0},
    {INJECT, (char*)&pkt6[0], sizeof(pkt6), 0},
    {MDNS_CHECK_RR_DATA, (char*)mdns_rr_data, 1, 0},
    {MDNS_CHECK_RR_COUNT_REMOTE, NX_NULL, 6, 0},
    {INJECT, (char*)&pkt7[0], sizeof(pkt7), 0},
    {MDNS_CHECK_RR_COUNT_REMOTE, NX_NULL, 6, 0},
    {WAIT, NX_NULL, 0, 1},
    {MDNS_CHECK_RR_COUNT_REMOTE, NX_NULL, 2, 0},
    {INJECT, (char*)&pkt8[0], sizeof(pkt8), 0},
    {MDNS_CHECK_RR_COUNT_REMOTE, NX_NULL, 3, 0},
};

int mdns_client_passive_size = sizeof(mdns_client_passive) / sizeof(MDNS_TEST_SEQ);

#endif /* __PRODUCT_NETXDUO__  */
